//
//  WPMoreDetailMaleVC.m
//  wobingwoyi
//
//  Created by WGP on 2016/11/15.
//  Copyright © 2016年 WGP. All rights reserved.
//

#import "WPMoreDetailMaleVC.h"
#import "WPBodyPartDiseaseModel.h"
#import "WPDiseaseTypesVC.h"

#define MaxSCale 2.5  //最大缩放比例
#define MinScale 1.0  //最小缩放比例
#define kHeightScale ((SCREEN_HEIGHT-107)/560)
#define kWidthScale (self.view.frame.size.width/375)
#define kMargin 40
#define kImageScale (5/11)
@interface WPMoreDetailMaleVC ()<UITableViewDelegate,UITableViewDataSource,UIScrollViewDelegate>

@property(nonatomic,strong)UIImageView *bgImageView;
@property(nonatomic,assign)CGFloat totalScale;

@property(nonatomic,strong)UIButton *coverBtn;
@property(nonatomic,strong)UIButton *heartBtn;
@property(nonatomic,strong)UIButton *skeletonBtn;
@property(nonatomic,strong)UIButton *stomachBtn;
@property(nonatomic,strong)UIButton *nerveBtn;
@property(nonatomic,strong)UIButton *currentBtn;
@property(nonatomic,strong)UIButton *changedBtn;

@property(nonatomic,strong)UITableView *partTableView;
@property(nonatomic,strong)UIView *bottomView;
@property(nonatomic,strong)UILabel *diseaseLabel;
@property(nonatomic,strong)NSArray *partArr;

@property(nonatomic,strong)NSMutableArray *diseasesArr;

@end

@implementation WPMoreDetailMaleVC

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.view.backgroundColor = [UIColor whiteColor];
    self.totalScale = 1.0;
    self.isPositive = YES;
    [self setupUI];
    
}

-(void)setupUI
{
    [self bgImageView];
    [self scrollView];
    [self imageView];
    [self partTableView];
    [self setupBtns];
    
//    [self bottomView];
}

-(UIScrollView *)scrollView
{
    if (_scrollView == nil)
    {
        _scrollView = [[UIScrollView alloc] init];
        _scrollView.delegate = self;
        _scrollView.backgroundColor = [UIColor clearColor];
        [_scrollView setMinimumZoomScale:1.0];
        [_scrollView setMaximumZoomScale:2.5f];
        
        _scrollView.showsVerticalScrollIndicator = NO;
        _scrollView.showsHorizontalScrollIndicator = NO;
        
        _scrollView.bounces = NO;
        _scrollView.bouncesZoom = NO;
        
        CGSize newSize = [UIImage imageNamed:@"body"].size;
        //_scrollview可以拖动的范围
        [_scrollView setContentSize:newSize];
        [self.view addSubview:_scrollView];
        
        [_scrollView mas_makeConstraints:^(MASConstraintMaker *make) {
            
            make.edges.equalTo(self.view);
        }];
    }
    return _scrollView;
}

-(UIImageView *)bgImageView
{
    if (_bgImageView == nil)
    {
        _bgImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"bgCase"]];
        [self.view addSubview:_bgImageView];
        
        [_bgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.edges.equalTo(self.view);
        }];
        
    }
    return _bgImageView;
}

-(UIImageView *)imageView
{
    if (_imageView == nil)
    {
        UIImage *image = [UIImage imageNamed:[self.partArr[0] imageName]];
        
        _imageView = [[UIImageView alloc] initWithImage:image];
        _imageView.userInteractionEnabled = YES;
        [self.scrollView addSubview:_imageView];
        
        CGFloat imageScale = image.size.width/image.size.height;
        
        CGFloat imageH = (SCREEN_HEIGHT-108)-8*kHeightScale;
        CGFloat imageW = imageH * imageScale;
        CGFloat imageX = (self.view.bounds.size.width-imageW)*0.5;
        CGFloat imageY = (SCREEN_HEIGHT-108) - imageH;
        
        _imageView.frame = CGRectMake(imageX, imageY, imageW, imageH);
        
//        NSLog(@"%@",NSStringFromCGRect(_imageView.frame));
        // 单击
        UITapGestureRecognizer *SingleTapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(resetImage:)];
        SingleTapGesture.numberOfTapsRequired = 1;//tap次数
        SingleTapGesture.numberOfTouchesRequired = 1;
        [_imageView addGestureRecognizer:SingleTapGesture];
        
        UITapGestureRecognizer* tap =[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapGesAction:)];//给imageview添加tap手势
        tap.numberOfTapsRequired = 2;//双击图片执行tapGesAction
        _imageView.userInteractionEnabled=YES;
        [_imageView addGestureRecognizer:tap];
        
        // 关键在这一行，如果双击确定偵測失败才會触发单击
        [SingleTapGesture requireGestureRecognizerToFail:tap];
    }
    return _imageView;
}

-(UITableView *)partTableView
{
    if (_partTableView == nil)
    {
        _partTableView = [[UITableView alloc] init];
        _partTableView.backgroundColor = [UIColor clearColor];
        [_partTableView registerClass:[WPHumanPartCell class] forCellReuseIdentifier:@"WPHumanPartCell"];
        _partTableView.delegate = self;
        _partTableView.dataSource = self;
        _partTableView.separatorStyle = UITableViewCellSeparatorStyleNone;
        _partTableView.rowHeight = 35+kMargin*kHeightScale;
        _partTableView.bounces = NO;
        _partTableView.showsVerticalScrollIndicator = YES;
        _partTableView.allowsSelection = NO;
        [self.view addSubview:_partTableView];
        
        [_partTableView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.width.mas_equalTo(45);
            make.height.mas_equalTo(35*5+4*kMargin*kHeightScale);
            make.top.equalTo(self.view).offset(30);
            make.left.equalTo(self.view).offset(20);
        }];
    }
    return _partTableView;
}

-(void)setupBtns
{
    self.changedBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    [self.changedBtn setBackgroundImage:[UIImage imageNamed:@"changeIcon"] forState:UIControlStateNormal];
    [self.changedBtn addTarget:self action:@selector(changeBtnDidClick:) forControlEvents:UIControlEventTouchDown];
    [self.view addSubview:self.changedBtn];
    
    [self.changedBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.width.height.mas_equalTo(60);
        make.right.equalTo(self.view).offset(-30);
        make.bottom.equalTo(self.view).offset(-60);
    }];
}

-(UIView *)bottomView
{
    if (_bottomView == nil)
    {
        _bottomView  = [UIView new];
        _bottomView.bounds = CGRectMake(0, 0, SCREEN_WIDTH, 150*kHeightScale);
        UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"moreDetailBg"]];
        [_bottomView addSubview:imageView];
        imageView.frame = _bottomView.bounds;
        
        UIView *topView = [UIView new];
        topView.backgroundColor = [UIColor whiteColor];
        [_bottomView addSubview:topView];
        [topView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.right.equalTo(_bottomView);
            make.top.equalTo(_bottomView).offset(15*kHeightScale);
            make.height.mas_equalTo(45*kHeightScale);
        }];
        
        UIImageView *topline = [UIImageView lineImageView];
        [topView addSubview:topline];
        [topline mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.left.right.equalTo(topView);
            make.height.mas_equalTo(0.5);
        }];
        
        UIImageView *bottomline = [UIImageView lineImageView];
        [topView addSubview:bottomline];
        [bottomline mas_makeConstraints:^(MASConstraintMaker *make) {
            make.bottom.left.right.equalTo(topView);
            make.height.mas_equalTo(0.5);
        }];
        
        UILabel *diseaseLabel = [UILabel new];
        diseaseLabel.textColor = GLobalFontColor;
        diseaseLabel.font = [UIFont systemFontOfSize:15];
        diseaseLabel.text  = @"头部疾病";
        self.diseaseLabel = diseaseLabel;
        [topView addSubview:diseaseLabel];
        [diseaseLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(topView);
            make.left.equalTo(topView).offset(15);
        }];
        
        UILabel *tipLabel = [UILabel new];
        tipLabel.textColor = GloballightFontColor;
        tipLabel.font = [UIFont systemFontOfSize:13];
        tipLabel.text = @"(请选择疾病)";
        [topView addSubview:tipLabel];
        [tipLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(topView);
            make.left.equalTo(diseaseLabel.mas_right).offset(10);
        }];
        
        UILabel *rightTipLabel = [UILabel new];
        rightTipLabel.textColor = GlobalColor;
        rightTipLabel.text = @"上下滑动查看更多";
        rightTipLabel.font = [UIFont systemFontOfSize:12];
        [topView addSubview:rightTipLabel];
        [rightTipLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(topView);
            make.right.equalTo(topView).offset(-10);
        }];
        
        UIScrollView *bottomScrollView = [[UIScrollView alloc] init];
        bottomScrollView.backgroundColor = [UIColor whiteColor];
        bottomScrollView.bounces = NO;
        [_bottomView addSubview:bottomScrollView];
//        [bottomScrollView mas_makeConstraints:^(MASConstraintMaker *make) {
//            make.left.right.bottom.equalTo(_bottomView);
//            make.top.equalTo(topView.mas_bottom);
//        }];
        bottomScrollView.frame = CGRectMake(0, 60*kHeightScale, SCREEN_WIDTH, 90*kHeightScale);
        
//        self.diseasesArr = [NSMutableArray arrayWithObjects:@"头痛",@"情绪低落",@"头痛",@"情绪低落",@"头痛",@"情绪低落",@"头痛",@"情绪低落", nil];
        
        for (int i = 0; i < self.diseasesArr.count; i++)
        {
            CGFloat btnW = SCREEN_WIDTH / 3.0;
            NSString *str = self.diseasesArr[i];
            UIButton *diseaseBtn = [UIButton buttonWithType:UIButtonTypeCustom];
            [diseaseBtn setTitle:str forState:UIControlStateNormal];
            [diseaseBtn setTitleColor:GLobalFontColor forState:UIControlStateNormal];
            [diseaseBtn setBackgroundImage:[UIImage imageNamed:@"diseaseBtn_bg"] forState:UIControlStateNormal];
            diseaseBtn.titleLabel.font = [UIFont systemFontOfSize:14];
            [diseaseBtn addTarget:self action:@selector(diseaseBtnDidClick:) forControlEvents:UIControlEventTouchDown];
            diseaseBtn.tag = i;
            int row = i / 3;
            int low = i % 3;
            diseaseBtn.frame = CGRectMake(low*btnW, row*45, btnW, 45);
            [bottomScrollView addSubview:diseaseBtn];
        }
        
        if(self.diseasesArr.count%3)
        {
            bottomScrollView.contentSize = CGSizeMake(SCREEN_WIDTH, (self.diseasesArr.count / 3 + 1)*45);
        }
        else
        {
            bottomScrollView.contentSize = CGSizeMake(SCREEN_WIDTH, (self.diseasesArr.count / 3)*45);
        }
        
    }
    return _bottomView;
}

-(void)changeBtnDidClick:(UIButton *)btn
{
        //zoomScale这个值决定了contents当前扩展的比例
        if (self.scrollView.zoomScale > 1.0)
        {
            CGRect zoomRect = [self zoomRectForScale:1.0 withCenter:CGPointMake(10, 10)];
            [self.scrollView zoomToRect:zoomRect animated:YES];
        }
    
        if (self.isPositive)
        {
            self.imageView.image = [UIImage imageNamed:[NSString stringWithFormat:@"%@_back",self.currentModel.imageName]];
        }
        else
        {
            self.imageView.image = [UIImage imageNamed:self.currentModel.imageName];
        }
        self.isPositive = !self.isPositive;

}

//单击恢复视图
- (void)resetImage:(UITapGestureRecognizer *)recognizer
{
    
    CGPoint currentPoint = [recognizer locationInView:self.scrollView];
    CGPoint covertPoint = [self.scrollView convertPoint:currentPoint toView:self.imageView];
    
//     NSLog(@"单击:%@",NSStringFromCGPoint(covertPoint));
    
    CGFloat imageW = self.imageView.bounds.size.width;
    CGFloat wScale = imageW / 250;
    
    [self partOfBodyDidClickWithPoint:covertPoint scale:wScale];
}

-(void)partOfBodyDidClickWithPoint:(CGPoint)covertPoint scale:(CGFloat)scale
{
    //判断当前是哪一张,是正面还是背面
    NSArray *arr = nil;
    if (self.currentCell.indexPath.item == 0)
    {
        if (self.isPositive)
        {
            arr = self.firstPositiveModelArr;
        }
        else
        {
            arr = self.firstOppositeModelArr;
        }
    }
    else if (self.currentCell.indexPath.item == 1)
    {
        if (self.isPositive)
        {
            arr = self.secondPositiveModelArr;
        }
        else
        {
            arr = self.secondOppositeModelArr;
        }
    }
    else if (self.currentCell.indexPath.item == 2)
    {
        if (self.isPositive)
        {
            arr = self.thirdPositiveModelArr;
        }
        else
        {
             return ;
        }

    }
    else if (self.currentCell.indexPath.item == 3)
    {
        if (self.isPositive)
        {
            arr = self.fourthPositiveModelArr;
        }
        else
        {
             return ;
        }
    }
    else if (self.currentCell.indexPath.item == 4)
    {
        if (self.isPositive)
        {
            arr = self.fifthPositiveModelArr;
        }
        else
        {
             return ;
        }
    }
    else if (self.currentCell.indexPath.item == 5)
    {
        arr = self.sixthModelArr;
    }
    else if (self.currentCell.indexPath.item == 6)
    {
        arr = self.sevenModelArr;
    }
    else if (self.currentCell.indexPath.item == 7)
    {
        arr = self.eightModelArr;
    }
    
    WPBodyPartDiseaseModel *partModel = nil;
    
    for (WPBodyPartDiseaseModel *model in arr)
    {
        CGRect rect = model.partRect;
        rect = CGRectMake(rect.origin.x*scale, rect.origin.y*scale, rect.size.width*scale, rect.size.height*scale);
        
        if (CGRectContainsPoint(rect, covertPoint))
        {
            partModel = model;
            break;
        }
    }
    
    if (partModel)
    {
        NSString *url = @"diseaseCategory/getCategory.do";
        
        NSString *sex = nil;
        if (self.order == 0)
        {
            sex = @"man";
        }
        else if(self.order == 1)
        {
            sex = @"woman";
        }
        
        [self showWithStatus:@"正在加载"];
        
        NSDictionary *dict = @{partModel.type:partModel.partName,@"sex":sex};
        
        
        [[WPNetWorkManager sharedNetWorkManager] POST:url parameters:dict progress:^(NSProgress * _Nonnull uploadProgress) {
            
        } success:^(NSURLSessionDataTask * _Nonnull task, id  _Nullable responseObject) {
            
            
            [self dismiss];
            if([responseObject[@"result"] isEqualToString:@"success"])
            {
                [self.diseasesArr removeAllObjects];
                
                for (NSString *str in responseObject[@"detail"])
                {
                    [self.diseasesArr addObject:str];
                }
    
                [self bodyBtnDidClick];
                self.diseaseLabel.text = [NSString stringWithFormat:@"%@疾病",partModel.partName];
            }
            else
            {
                //            考虑到账号过期的情况
                if ([responseObject[@"detail"] isEqualToString:@"illegalLogin"])
                {
                    //                账号过期
                    [self illegalLoginWithSuccessBlock:^{
                        //提示账号过期点击确定之后
                        
                    }];
                }
                else
                {
                    [self showErrorInfoWithStatus:@"加载失败"];
                }
            }
        } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
            
            [self dismiss];
            [self showErrorInfoWithStatus:@"网络错误"];
        }];
    }
}

-(void)tapGesAction:(UIGestureRecognizer*)gestureRecognizer//手势执行事件
{
    
    float newScale = 0;
    //zoomScale这个值决定了contents当前扩展的比例
    if (self.scrollView.zoomScale > 1.0)
    {
        newScale = 1.0;
    }
    else
    {
        newScale = 2.5;
    }
    
    CGRect zoomRect = [self zoomRectForScale:newScale withCenter:[gestureRecognizer locationInView:gestureRecognizer.view]];
    [self.scrollView zoomToRect:zoomRect animated:YES];
}

- (CGRect)zoomRectForScale:(float)scale withCenter:(CGPoint)center
{
    CGRect zoomRect;
    zoomRect.size.height = self.scrollView.frame.size.height / scale;
    zoomRect.size.width  = self.scrollView.frame.size.width  / scale;
    zoomRect.origin.x = center.x - (zoomRect.size.width  / 2.0);
    zoomRect.origin.y = center.y - (zoomRect.size.height / 2.0);
//    zoomRect.origin.x = self.scrollView.center.x-(zoomRect.size.width  / 2.0);
//    zoomRect.origin.y = self.scrollView.center.y-(zoomRect.size.height / 2.0);

    return zoomRect;
}

#pragma mark - UIScrollView的代理方法
-(UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView
{
    return self.imageView;
}

- (void)scrollViewDidZoom:(UIScrollView *)scrollView
{
    //目前contentsize的width是否大于原scrollview的contentsize，如果大于，设置imageview中心x点为contentsize的一半，以固定imageview在该contentsize中心。如果不大于说明图像的宽还没有超出屏幕范围，可继续让中心x点为屏幕中点，此种情况确保图像在屏幕中心。
    CGFloat xcenter = scrollView.center.x ;
    CGFloat ycenter = scrollView.center.y;
    
     xcenter = scrollView.contentSize.width > scrollView.frame.size.width ? scrollView.contentSize.width/2 : xcenter;
    
    ycenter = scrollView.contentSize.height > scrollView.frame.size.height ? scrollView.contentSize.height/2 : ycenter;
    [self.imageView setCenter:CGPointMake(xcenter, ycenter)];
}

#pragma mark - 按钮点击事件
-(void)bodyBtnDidClick
{
    UIButton *coverBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        self.coverBtn = coverBtn;
    UIWindow *keyWindow = [UIApplication sharedApplication].keyWindow;
    coverBtn.backgroundColor = [UIColor clearColor];
    [keyWindow addSubview:coverBtn];
    coverBtn.frame = [UIScreen mainScreen].bounds;
    [coverBtn addTarget:self action:@selector(coverBtnDidClick:) forControlEvents:UIControlEventTouchDown];
    
    [coverBtn addSubview:self.bottomView];
    
    self.bottomView.frame = CGRectMake(0, SCREEN_HEIGHT, SCREEN_WIDTH, self.bottomView.bounds.size.height);
    [UIView animateWithDuration:0.25 animations:^{
        self.bottomView.frame = CGRectMake(0, SCREEN_HEIGHT-self.bottomView.bounds.size.height, SCREEN_WIDTH, self.bottomView.bounds.size.height);
    }];
}

-(void)coverBtnDidClick:(UIButton *)btn
{
    [UIView animateWithDuration:0.20 animations:^{
        
        self.bottomView.frame = CGRectMake(0, SCREEN_HEIGHT, SCREEN_WIDTH, self.bottomView.bounds.size.height);
    } completion:^(BOOL finished) {
       
        [btn removeFromSuperview];
        self.bottomView = nil;
    }];
    
}

-(void)diseaseBtnDidClick:(UIButton *)btn
{
    [self coverBtnDidClick:self.coverBtn];
    
    //疾病点击
    WPDiseaseTypesVC *ccVC = [WPDiseaseTypesVC new];
    NSString *str = self.diseasesArr[btn.tag];
    ccVC.diseaseTitle = str;
    ccVC.isPop = YES;
    ccVC.isPartOfHuman = YES;
    [self.navigationController pushViewController:ccVC animated:YES];
}

#pragma mark - 数据源方法
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return self.partArr.count;
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    WPHumanPartCell *cell = [tableView dequeueReusableCellWithIdentifier:@"WPHumanPartCell"];
    cell.indexPath = indexPath;
    cell.model = self.partArr[indexPath.item];
    if (self.currentCell == nil && indexPath.item == 0)
    {
        self.currentCell = cell;
        self.currentModel = self.partArr[indexPath.item];
    }
    __weak typeof(self) weakSelf = self;
    __weak typeof(cell) weakCell = cell;
    cell.didSelectedBlock = ^(){
        
        if(weakSelf.currentCell == weakCell)
        {
            return ;
        }
        else
        {
            weakSelf.currentCell.partBtn.selected = NO;
            weakSelf.currentModel.isSelected  = NO;
            
            weakSelf.currentCell = weakCell;
            weakSelf.currentModel = self.partArr[indexPath.item];
            
            weakSelf.currentCell.partBtn.selected = YES;
            weakSelf.currentModel.isSelected = YES;
            
        }
        
        //zoomScale这个值决定了contents当前扩展的比例
        if (self.scrollView.zoomScale > 1.0)
        {
            CGRect zoomRect = [self zoomRectForScale:1.0 withCenter:CGPointMake(10, 10)];
            [self.scrollView zoomToRect:zoomRect animated:YES];
        }
        
        if(self.order == 0)
        {
            weakSelf.imageView.image = [UIImage imageNamed:weakSelf.currentModel.imageName];
        }
        else if(self.order == 1)
        {
            weakSelf.imageView.image = [UIImage imageNamed:[NSString stringWithFormat:@"female_%@",weakSelf.currentModel.imageName]];
        }
        else
        {
            weakSelf.imageView.image = [UIImage imageNamed:weakSelf.currentModel.imageName];
        }
        
        self.isPositive = YES;
        
        [tableView scrollToRowAtIndexPath:indexPath atScrollPosition:UITableViewScrollPositionTop animated:YES];
        
        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (CGFloat)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
            
            UIWindow *keyWindow = [UIApplication sharedApplication].keyWindow;
            CGPoint point = [weakSelf.currentCell convertPoint:weakSelf.currentCell.partBtn.center toView:keyWindow];
            
            [self showTipInfoWith:weakSelf.currentModel.tipStr toView:keyWindow rect:point];
        });
    };
    return cell;
}

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    
}

-(void)showTipInfoWith:(NSString *)tipStr toView:(UIWindow *)keyWindow rect:(CGPoint)rect
{
    UIButton *tipBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    [tipBtn setBackgroundImage:[UIImage imageNamed:@"tipInfoBg"] forState:UIControlStateNormal];
    [tipBtn setTitle:tipStr forState:UIControlStateNormal];
    tipBtn.titleLabel.font = [UIFont systemFontOfSize:13];
    [tipBtn setTitleColor:GLobalFontColor forState:UIControlStateNormal];
    [keyWindow addSubview:tipBtn];
    
    CGSize size = [tipStr sizeWithMaxSize:CGSizeMake(MAXFLOAT, MAXFLOAT) font:13];
    CGFloat btnWidth = size.width + 20;
    
    tipBtn.bounds = CGRectMake(0, 0, btnWidth, 18.5);
    tipBtn.center = CGPointMake(rect.x+35*0.5+10 + btnWidth*0.5, rect.y);
    
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
        
        [UIView animateWithDuration:0.3 animations:^{
            
            tipBtn.alpha = 0.0;
        } completion:^(BOOL finished) {
            
            [tipBtn removeFromSuperview];
        }];
    });
}

-(NSArray *)partArr
{
    if (_partArr == nil)
    {
        WPHumanPartModel *model1 = [WPHumanPartModel modelWithName:@"body" tipStr:@"人体实体图" isSelected:YES];
        WPHumanPartModel *model3 = [WPHumanPartModel modelWithName:@"visceral" tipStr:@"五脏六腑图" isSelected:NO];
        WPHumanPartModel *model5 = [WPHumanPartModel modelWithName:@"lung" tipStr:@"呼吸系统图" isSelected:NO];
        WPHumanPartModel *model4 = [WPHumanPartModel modelWithName:@"stomach" tipStr:@"消化系统图" isSelected:NO];
        WPHumanPartModel *model6 = [WPHumanPartModel modelWithName:@"heart" tipStr:@"心血管系统图" isSelected:NO];
        WPHumanPartModel *model7 = [WPHumanPartModel modelWithName:@"nerve" tipStr:@"神经系统图" isSelected:NO];
        WPHumanPartModel *model2 = [WPHumanPartModel modelWithName:@"muscle" tipStr:@"人体肌肉图" isSelected:NO];
        WPHumanPartModel *model8 = [WPHumanPartModel modelWithName:@"skeleton" tipStr:@"人体骨骼图" isSelected:NO];
        
        _partArr = [NSArray arrayWithObjects:model1,model3,model5,model4,model6,model7,model2,model8, nil];
    }
    return _partArr;
}

-(NSMutableArray *)diseasesArr
{
    if (_diseasesArr == nil)
    {
        _diseasesArr = [NSMutableArray array];
    }
    return _diseasesArr;
}

@end
